package com.wzl.demo_06_04;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    //Activity 获取Fragment内容
    public void getFragment(View view){
        Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragmentContainerView);
        View v = f.getView();
        TextView tv = (TextView)v.findViewById(R.id.textView);
        Log.i(MainActivity.class.getName(), tv.getText().toString() );
    }
}